package gateway.server.lifecycle;

import gateway.api.aware.DisposableAware;

/**
 * @author Jin Zheng
 * @since 1.0 2020-09-25
 */
public class DisposableLifecycle implements Lifecycle
{
	public DisposableLifecycle()
	{
	}

	@Override
	public boolean accepted(Object target)
	{
		return target instanceof DisposableAware;
	}

	@Override
	public void handle(Object target) throws Exception
	{
		DisposableAware aware = (DisposableAware) target;
		aware.destroy();
	}
}
